package com.demo.spring.mvc.action;

import com.demo.spring.mvcframework.annotation.Autowired;
import com.demo.spring.mvcframework.annotation.Controller;
import com.demo.spring.mvcframework.annotation.RequestMapping;
import com.demo.spring.mvcframework.annotation.RequestParam;
import com.demo.spring.service.DemoService;
import com.demo.spring.service.impl.DemoServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: ganxinle
 * \* Date: 2020/1/8
 * \* Time: 11:07
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
@Controller
@RequestMapping("/demo")
public class DemoAction {
    @Autowired
    DemoServiceImpl demoServiceImpl;

    @RequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response, @RequestParam("name")String name){
        String result = demoServiceImpl.get(name);
        System.out.println("================>query");
        System.out.println(System.currentTimeMillis());
        try {
            response.getWriter().write(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }



}